/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fasea.search.documents;

/**
 *
 * @author WolframL
 */
public class MP3Document extends Document {

    public MP3Document(org.apache.lucene.document.Document document) {
        setDocument(document);
    }

    @Override
    public String getFragment() {
        StringBuilder fragmentBuilder = new StringBuilder();
        String tmp = document.get("artist");
        fragmentBuilder.append("<font face=\"arial,sans-serif\" size=\"4\" color=\"#96b1cb\">");
        if (tmp != null && tmp.trim().compareTo("") != 0) {
            fragmentBuilder.append("Artist: ").append(tmp);
            fragmentBuilder.append("&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp");
        } else {
            fragmentBuilder.append("Artist: N/A");
            fragmentBuilder.append("&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp");
        }

        tmp = document.get("album");
        if (tmp != null && tmp.trim().compareTo("") != 0) {
            fragmentBuilder.append(" Album: ").append(tmp).append("<br />");
        } else {
            fragmentBuilder.append(" Album: N/A<br />");
        }

        tmp = document.get("year");
        if (tmp != null && tmp.trim().compareTo("") != 0) {
            fragmentBuilder.append("Year:</B> ").append(tmp);
        } else {
            fragmentBuilder.append("Year: N/A");
        }
        fragmentBuilder.append("</font>");
        return fragmentBuilder.toString();
    }
}
